#!/bin/sh
#
# http://github.com/mitchweaver/bin
#
# play a video on the root window
#

[ -f "$1" ] || exit 1

pkill -9 xwinwrap

xwin="xwinwrap -ni -sh rectangle -b -nf -ov -fs -- "

mpv="mpv --wid WID --no-config --keepaspect=no --loop \
    --no-border --vd-lavc-fast --x11-bypass-compositor=no \
    --gapless-audio=yes --vo=xv --hwdec=auto --really-quiet \
    --name=mpvbg"

$xwin $mpv "$1" > /dev/null &
echo -n $! > ${HOME}/.cache/mpvbg.pid
